import request from './request.js'

export const addArticle=(data)=>{
    return request({
        url:'api/article/add',
        method:'post',
        data
    })
}

export const addArticleByDraft=(data)=>{
    return request({
        url:'api/article/addByDraft',
        method:'post',
        data
    })
}

export const getArticleList=(pageIndex,pageSize)=>{
    return request({
        url:'article/getList',
        method:'get',
        params:{
            pageIndex,
            pageSize
        }
    })
}

export const getArticleCount=()=>{
    return request({
        url:'article/conunt',
        method:'get'
    })
}

export const getArticleById=(id)=>{
    return request({
        url:'article/get',
        method:'get',
        params:{
            id
        }
    })
}

export const getLastArticleList=(pageIndex,pageSize)=>{
    return request({
        url:'article/getLast',
        method:'get',
        params:{
            pageIndex,
            pageSize
        }
    })
}

export const addArticleLike=(id)=>{
    return request({
        url:'article/addLikeCount',
        method:'get',
        params:{
            id
        }
    })
}
export const getInfo=()=>{
    return request({
        url:'article/getInfo',
        method:'get'
    })
}

export const getArticleRank=()=>{
    return request({
        url:'article/getRank',
        method:'get'
    })
}

export const getArticleLastRank=()=>{
    return request({
        url:'article/getLastRank',
        method:'get'
    })
}

export const getArticleLikeRank=()=>{
    return request({
        url:'article/getLikeRank',
        method:'get'
    })
}

export const getAllArricle=(pageIndex,pageSize)=>{
    return request({
        url:'api/article/getAll',
        method:'get',
        params:{
            pageIndex,
            pageSize
        }
    })
}

export const deleteArticle=(id)=>{
    return request({
        url:'api/article/delete',
        method:'get',
        params:{
            id
        }
    })
}

export const updateArticle=(data)=>{
    return request({
        url:'api/article/update',
        method:'post',
        data
    })
}
